<?php
/**
*
* @package - SaveKb Mod
* @version $Id: savekb.php 2 2010-01-24 09:04:01Z allytools $
* @copyright (c) Pionier ( http://www.allytools.de/ )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB'))
{
	exit;
}
$user->add_lang('mods/lang_savekb');

$savekb_uni         = $config['savekb_uni'];
$savekb_limit       = $config['savekb_limit'];

if ($savekb_uni < 10)
{
    $contents = file_get_contents("http://www.savekb.de/forenplugin/kb.php?uni=0$savekb_uni&limit=$savekb_limit");
}
ELSE
{
    $contents = file_get_contents("http://www.savekb.de/forenplugin/kb.php?uni=$savekb_uni&limit=$savekb_limit");
}

$contents = preg_replace('/(?:<br ?\/?>|\s)*$/', '', $contents);

$lines = explode('<br />', $contents);

foreach($lines AS $line)
    {
        $datas = explode(';', $line); 

            $template->assign_block_vars('block_savekb', array(
                'ANGREIFER'       => $datas['0'], 
                'VERTEIDIGER'     => $datas['1'],
                'UNITS'           => $datas['2'],
                'LINK'            => $datas['3'] 
            ));
    }

if ($config['savekb_on'])
	{
		$template->assign_vars(array(
			'S_DISPLAY_SAVEKB' => true,
		));
	}

$template->assign_vars(array(
        'NUM_TOP_KBS'           => $savekb_limit,
        'UNI'                   => $savekb_uni,
        'SAVEKB_MOD_RELEASE'    => sprintf($user->lang['SAVEKB_COPY'], $config['savekb_version'])
    ));

?>